home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / bash_114.zip / bash-1.14.2 / documentation / article.txt < prev    next >
Text File  |  1994-07-18  |  48KB  |  1,112 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                    Bash - The GNU shell*
  11.  
  12.  
  13.                          Chet Ramey
  14.               Case Western Reserve University
  15.                       chet@po.cwru.edu
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. _1.  _I_n_t_r_o_d_u_c_t_i_o_n
  23.  
  24.      _B_a_s_h is the shell,  or  command  language  interpreter,
  25. that  will  appear in the GNU operating system.  The name is
  26. an acronym for the "Bourne-Again  SHell",  a  pun  on  Steve
  27. Bourne,  the  author  of  the direct ancestor of the current
  28. UNIX|- shell /_b_i_n/_s_h, which appeared in the  Seventh  Edition
  29. Bell Labs Research version of UNIX.
  30.  
  31.      Bash is an sh-compatible shell that incorporates useful
  32. features  from  the  Korn shell (ksh) and the C shell (csh),
  33. described later in this article.  It is ultimately  intended
  34. to  be  a  conformant implementation of the IEEE POSIX Shell
  35. and Utilities specification (IEEE Working Group 1003.2).  It
  36. offers  functional improvements over sh for both interactive
  37. and programming use.
  38.  
  39.      While the GNU operating system will most likely include
  40. a  version  of  the  Berkeley  shell  csh,  Bash will be the
  41. default shell.  Like other GNU software, Bash is quite port-
  42. able.  It currently runs on nearly every version of UNIX and
  43. a few other operating systems -  an  independently-supported
  44. port  exists  for OS/2, and there are rumors of ports to DOS
  45. and Windows NT.  Ports to UNIX-like systems such as QNX  and
  46. Minix are part of the distribution.
  47.  
  48.      The original author of Bash was Brian Fox, an  employee
  49. of  the Free Software Foundation.  The current developer and
  50. maintainer is Chet Ramey, a  volunteer  who  works  at  Case
  51. Western Reserve University.
  52.  
  53. _2.  _W_h_a_t'_s _P_O_S_I_X, _a_n_y_w_a_y?
  54.  
  55.      _P_O_S_I_X is a name originally coined by  Richard  Stallman
  56. _________________________
  57. *An earlier version of this  article  appeared  in  The
  58. Linux Journal.
  59. |- UNIX is a trademark of Bell Laboratories.
  60.  
  61.  
  62.  
  63.  
  64.                        July 18, 1994
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                            - 2 -
  71.  
  72.  
  73. for a family of open system standards based on UNIX.   There
  74. are  a  number  of  aspects  of UNIX under consideration for
  75. standardization, from the basic system services at the  sys-
  76. tem  call  and  C library level to applications and tools to
  77. system administration and management.  Each  area  of  stan-
  78. dardization  is  assigned  to  a  working  group in the 1003
  79. series.
  80.  
  81.      The  POSIX  Shell  and  Utilities  standard  has   been
  82. developed by IEEE Working Group 1003.2 (POSIX.2).|=  It  con-
  83. centrates  on  the command interpreter interface and utility
  84. programs commonly executed from the command line or by other
  85. programs.   An  initial  version  of  the  standard has been
  86. approved and published by the IEEE, and  work  is  currently
  87. underway to update it.  There are four primary areas of work
  88. in the 1003.2 standard:
  89.  
  90. o+    Aspects of the shell's syntax and command language.   A
  91.      number  of  special  builtins  such  as _c_d and _e_x_e_c are
  92.      being specified as part of the shell, since their func-
  93.      tionality  usually  cannot be implemented by a separate
  94.      executable;
  95.  
  96. o+    A set of utilities to be called by  shell  scripts  and
  97.      applications.   Examples are programs like _s_e_d, _t_r, and
  98.      _a_w_k.  Utilities commonly implemented as shell  builtins
  99.      are  described  in this section, such as _t_e_s_t and _k_i_l_l.
  100.      An expansion of this section's scope, termed  the  User
  101.      Portability   Extension,   or   UPE,  has  standardized
  102.      interactive programs such as _v_i and _m_a_i_l_x;
  103.  
  104. o+    A group of functional interfaces to  services  provided
  105.      by  the  shell,  such  as  the  traditional  system() C
  106.      library function.  There are functions to perform shell
  107.      word expansions, perform filename expansion (_g_l_o_b_b_i_n_g),
  108.      obtain values of  POSIX.2  system  configuration  vari-
  109.      ables,   retrieve   values   of  environment  variables
  110.      (getenv()), _a_n_d _o_t_h_e_r _s_e_r_v_i_c_e_s;
  111.  
  112. o+    A suite of "development" utilities  such  as  _c_8_9  (the
  113.      POSIX.2 version of _c_c), and _y_a_c_c.
  114.  
  115.      Bash is concerned  with  the  aspects  of  the  shell's
  116. behavior defined by POSIX.2.  The shell command language has
  117. of course been standardized, including the basic  flow  con-
  118. trol  and  program execution constructs, I/O redirection and
  119. pipelining, argument handling, variable expansion, and quot-
  120. ing.   The  _s_p_e_c_i_a_l  builtins,  which must be implemented as
  121. part of the shell to provide the desired functionality,  are
  122. _________________________
  123. |=IEEE, _I_E_E_E  _S_t_a_n_d_a_r_d  _f_o_r  _I_n_f_o_r_m_a_t_i_o_n  _T_e_c_h_n_o_l_o_g_y  --
  124. _P_o_r_t_a_b_l_e  _O_p_e_r_a_t_i_n_g  _S_y_s_t_e_m  _I_n_t_e_r_f_a_c_e  (_P_O_S_I_X) _P_a_r_t _2:
  125. _S_h_e_l_l _a_n_d _U_t_i_l_i_t_i_e_s, 1992.
  126.  
  127.  
  128.  
  129.  
  130.                        July 18, 1994
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                            - 3 -
  137.  
  138.  
  139. specified as being part of the shell; examples of these  are
  140. _e_v_a_l  and _e_x_p_o_r_t.  Other utilities appear in the sections of
  141. POSIX.2 not devoted to the shell which are commonly (and  in
  142. some cases must be) implemented as builtin commands, such as
  143. _r_e_a_d and  _t_e_s_t.   POSIX.2  also  specifies  aspects  of  the
  144. shell's  interactive  behavior as part of the UPE, including
  145. job control and command line editing.  Interestingly enough,
  146. only  _v_i-style line editing commands have been standardized;
  147. _e_m_a_c_s editing commands were left out due to objections.
  148.  
  149.      While POSIX.2 includes much of what the shell has trad-
  150. itionally  provided, some important things have been omitted
  151. as being "beyond its scope."  There  is,  for  instance,  no
  152. mention  of a difference between a _l_o_g_i_n shell and any other
  153. interactive shell (since POSIX.2 does not  specify  a  login
  154. program).   No fixed startup files are defined, either - the
  155. standard does not mention ._p_r_o_f_i_l_e.
  156.  
  157. _3.  _B_a_s_i_c _B_a_s_h _f_e_a_t_u_r_e_s
  158.  
  159.      Since the Bourne shell provides Bash with most  of  its
  160. philosophical  underpinnings,  Bash  inherits  most  of  its
  161. features and functionality from sh.  Bash implements all  of
  162. the  traditional sh flow control constructs (_f_o_r, _i_f, _w_h_i_l_e,
  163. etc.).  All of the Bourne shell  builtins,  including  those
  164. not  specified  in  the  POSIX.2  standard,  appear in Bash.
  165. Shell _f_u_n_c_t_i_o_n_s, introduced  in  the  SVR2  version  of  the
  166. Bourne  shell, are similar to shell scripts, but are defined
  167. using a special syntax and are executed in the same  process
  168. as the calling shell.  Bash has shell functions which behave
  169. in a fashion upward-compatible with sh functions.  There are
  170. certain shell variables that Bash interprets in the same way
  171. as sh, such as _P_S_1, _I_F_S, and _P_A_T_H.  Bash  implements  essen-
  172. tially  the  same  grammar, parameter and variable expansion
  173. semantics, redirection, and quoting  as  the  Bourne  shell.
  174. Where  differences  appear  between the POSIX.2 standard and
  175. traditional sh behavior, Bash follows POSIX.
  176.  
  177.      The Korn Shell (ksh) is  a  descendent  of  the  Bourne
  178. shell  written at AT&T Bell Laboratories by David Korn|-.  It
  179. provides a number of useful features  that  POSIX  and  Bash
  180. have adopted.  Many of the interactive facilities in POSIX.2
  181. have their roots in the ksh: for example, the POSIX and  ksh
  182. job  control  facilities are nearly identical. Bash includes
  183. features from the Korn Shell for both  interactive  use  and
  184. shell programming.  For programming, Bash provides variables
  185. such as _R_A_N_D_O_M and _R_E_P_L_Y, the _t_y_p_e_s_e_t builtin,  the  ability
  186. to  remove  substrings from variables based on patterns, and
  187. shell arithmetic.  _R_A_N_D_O_M expands to a  random  number  each
  188. time it is referenced; assigning a value to _R_A_N_D_O_M seeds the
  189. _________________________
  190. |-Morris Bolsky and David Korn,  _T_h_e  _K_o_r_n_S_h_e_l_l  _C_o_m_m_a_n_d
  191. _a_n_d _P_r_o_g_r_a_m_m_i_n_g _L_a_n_g_u_a_g_e, Prentice Hall, 1989.
  192.  
  193.  
  194.  
  195.  
  196.                        July 18, 1994
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                            - 4 -
  203.  
  204.  
  205. random number generator.  _R_E_P_L_Y is the default variable used
  206. by  the  _r_e_a_d builtin when no variable names are supplied as
  207. arguments.  The _t_y_p_e_s_e_t builtin is used to define  variables
  208. and  give them attributes such as readonly.  Bash arithmetic
  209. allows the evaluation of an expression and the  substitution
  210. of the result.  Shell variables may be used as operands, and
  211. the result of an expression may be assigned to  a  variable.
  212. Nearly  all  of the operators from the C language are avail-
  213. able, with the same precedence rules:
  214.      $ echo $((3 + 5 * 32))
  215.      163
  216. For interactive use, Bash implements ksh-style  aliases  and
  217. builtins  such  as  _f_c  (discussed  below)  and  _j_o_b_s.  Bash
  218. aliases allow a string to be substituted for a command name.
  219. They  can  be  used  to create a mnemonic for a UNIX command
  220. name (alias del=rm), to expand a single word  to  a  complex
  221. command (alias news='xterm -g 80x45 -title trn -e trn -e -S1
  222. -N &'), or to ensure that a command is invoked with a  basic
  223. set of options (alias ls="/bin/ls -F").
  224.  
  225.      The C shell (csh)|-,  originally  written  by  Bill  Joy
  226. while  at Berkeley, is widely used and quite popular for its
  227. interactive facilities.  Bash includes a csh-compatible his-
  228. tory  expansion  mechanism  ("!  history"), brace expansion,
  229. access to a stack of directories via the  _p_u_s_h_d,  _p_o_p_d,  and
  230. _d_i_r_s  builtins, and tilde expansion, to generate users' home
  231. directories.  Tilde expansion has also been adopted by  both
  232. the Korn Shell and POSIX.2.
  233.  
  234.      There were certain areas in which  POSIX.2  felt  stan-
  235. dardization  was  necessary,  but no existing implementation
  236. provided the proper behavior.  The  working  group  invented
  237. and  standardized  functionality  in these areas, which Bash
  238. implements.  The _c_o_m_m_a_n_d builtin was invented so that  shell
  239. functions could be written to replace builtins; it makes the
  240. capabilities of the builtin available to the function.   The
  241. reserved  word "!" was added to negate the return value of a
  242. command or pipeline; it was nearly impossible to express "if
  243. not  x" cleanly using the sh language.  There exist multiple
  244. incompatible implementations  of  the  _t_e_s_t  builtin,  which
  245. tests  files  for  type  and  other  attributes and performs
  246. arithmetic and string comparisons.  POSIX considered none of
  247. these  correct,  so  the  standard behavior was specified in
  248. terms of the number of arguments to  the  command.   POSIX.2
  249. dictates  exactly  what will happen when four or fewer argu-
  250. ments are given to _t_e_s_t, and leaves the  behavior  undefined
  251. when  more  arguments  are  supplied.  Bash uses the POSIX.2
  252. _________________________
  253. |-Bill Joy, An Introduction to the C Shell, _U_N_I_X  _U_s_e_r'_s
  254. _S_u_p_p_l_e_m_e_n_t_a_r_y  _D_o_c_u_m_e_n_t_s,  University  of California at
  255. Berkeley, 1986.
  256.  
  257.  
  258.  
  259.  
  260.                        July 18, 1994
  261.  
  262.  
  263.  
  264.  
  265.  
  266.                            - 5 -
  267.  
  268.  
  269. algorithm, which was conceived by David Korn.
  270.  
  271. _3._1.  _F_e_a_t_u_r_e_s _n_o_t _i_n _t_h_e _B_o_u_r_n_e _S_h_e_l_l
  272.  
  273.      There are a number of minor  differences  between  Bash
  274. and  the  version  of  sh  present on most other versions of
  275. UNIX.  The majority of these are due to the POSIX  standard,
  276. but some are the result of Bash adopting features from other
  277. shells.  For instance, Bash includes the  new  "!"  reserved
  278. word,  the  _c_o_m_m_a_n_d builtin, the ability of the _r_e_a_d builtin
  279. to correctly return a line ending with a backslash, symbolic
  280. arguments  to the _u_m_a_s_k builtin, variable substring removal,
  281. a way to get the length of a variable, and the new algorithm
  282. for  the  _t_e_s_t  builtin  from  the POSIX.2 standard, none of
  283. which appear in sh.
  284.  
  285.      Bash also implements the "$(...)" command  substitution
  286. syntax,  which  supersedes  the  sh  `...`  construct.   The
  287. "$(...)" construct expands to the output of the command con-
  288. tained   within  the  parentheses,  with  trailing  newlines
  289. removed.  The sh syntax is accepted for  backwards  compati-
  290. bility, but the "$(...)" form is preferred because its quot-
  291. ing rules are much simpler and it is easier to nest.
  292.  
  293.      The Bourne shell does  not  provide  such  features  as
  294. brace  expansion,  the  ability  to  define a variable and a
  295. function with the same name, local variables in shell  func-
  296. tions, the ability to enable and disable individual builtins
  297. or write a function to replace a  builtin,  or  a  means  to
  298. export a shell function to a child process.
  299.  
  300.      Bash has closed a long-standing shell security hole  by
  301. not  using  the $_I_F_S variable to split each word read by the
  302. shell, but splitting only the results of expansion (ksh  and
  303. the  4.4  BSD  sh have fixed this as well).  Useful behavior
  304. such as a means to abort execution of a script read with the
  305. "."  command  using  the  return  builtin  or  automatically
  306. exporting variables in the shell's environment  to  children
  307. is  also  not  present in the Bourne shell.  Bash provides a
  308. much more powerful environment for both interactive use  and
  309. programming.
  310.  
  311. _4.  _B_a_s_h-_s_p_e_c_i_f_i_c _F_e_a_t_u_r_e_s
  312.  
  313.      This section details a few of the features  which  make
  314. Bash unique.  Most of them provide improved interactive use,
  315. but a few programming  improvements  are  present  as  well.
  316. Full descriptions of these features can be found in the Bash
  317. documentation.
  318.  
  319. _4._1.  _S_t_a_r_t_u_p _F_i_l_e_s
  320.  
  321.      Bash executes  startup  files  differently  than  other
  322. shells.   The  Bash behavior is a compromise between the csh
  323.  
  324.  
  325.  
  326.                        July 18, 1994
  327.  
  328.  
  329.  
  330.  
  331.  
  332.                            - 6 -
  333.  
  334.  
  335. principle of startup files with  fixed  names  executed  for
  336. each shell and the sh "minimalist" behavior.  An interactive
  337. instance of Bash started as a login shell reads and executes
  338. ~/._b_a_s_h__p_r_o_f_i_l_e  (the  file .bash_profile in the user's home
  339. directory), if it exists.  An  interactive  non-login  shell
  340. reads  and executes ~/._b_a_s_h_r_c.  A non-interactive shell (one
  341. begun to execute a shell script, for example) reads no fixed
  342. startup  file,  but  uses the value of the variable $_E_N_V, if
  343. set, as the name of a startup file.   The  ksh  practice  of
  344. reading  $_E_N_V  for every shell, with the accompanying diffi-
  345. culty of defining the proper  variables  and  functions  for
  346. interactive  and  non-interactive  shells or having the file
  347. read only for interactive shells, was  considered  too  com-
  348. plex.   Ease  of  use won out here.  Interestingly, the next
  349. release of ksh will change to reading $_E_N_V only for interac-
  350. tive shells.
  351.  
  352. _4._2.  _N_e_w _B_u_i_l_t_i_n _C_o_m_m_a_n_d_s
  353.  
  354.      There are a few builtins which are  new  or  have  been
  355. extended  in  Bash.   The _e_n_a_b_l_e builtin allows builtin com-
  356. mands to be turned on and off arbitrarily.  To use the  ver-
  357. sion  of  _e_c_h_o found in a user's search path rather than the
  358. Bash builtin, enable -n echo  suffices.   The  _h_e_l_p  builtin
  359. provides  quick  synopses  of  the  shell facilities without
  360. requiring access to a manual page.  _B_u_i_l_t_i_n  is  similar  to
  361. _c_o_m_m_a_n_d  in  that  it  bypasses shell functions and directly
  362. executes builtin commands.  Access to a csh-style  stack  of
  363. directories  is provided via the _p_u_s_h_d, _p_o_p_d, and _d_i_r_s buil-
  364. tins.  _P_u_s_h_d and _p_o_p_d insert and remove directories from the
  365. stack,  respectively, and _d_i_r_s lists the stack contents.  On
  366. systems that allow fine-grained control  of  resources,  the
  367. _u_l_i_m_i_t  builtin  can be used to tune these settings.  _U_l_i_m_i_t
  368. allows a user to control, among other things,  whether  core
  369. dumps  are  to  be generated, how much memory the shell or a
  370. child process is allowed to allocate, and how large  a  file
  371. created  by  a  child process can grow.  The _s_u_s_p_e_n_d command
  372. will stop the shell process when job control is active; most
  373. other  shells  do  not  allow  themselves to be stopped like
  374. that.  _T_y_p_e, the Bash answer to _w_h_i_c_h and _w_h_e_n_c_e, shows what
  375. will happen when a word is typed as a command:
  376.      $ type export
  377.      export is a shell builtin
  378.      $ type -t export
  379.      builtin
  380.      $ type bash
  381.      bash is /bin/bash
  382.      $ type cd
  383.      cd is a function
  384.      cd ()
  385.      {
  386.          builtin cd ${1+"$@"} && xtitle $HOST: $PWD
  387.      }
  388.  
  389.  
  390.                        July 18, 1994
  391.  
  392.  
  393.  
  394.  
  395.  
  396.                            - 7 -
  397.  
  398.  
  399. Various modes tell what a command word  is  (reserved  word,
  400. alias,  function,  builtin,  or  file) or which version of a
  401. command will be executed based  on  a  user's  search  path.
  402. Some  of  this functionality has been adopted by POSIX.2 and
  403. folded into the _c_o_m_m_a_n_d utility.
  404.  
  405. _4._3.  _E_d_i_t_i_n_g _a_n_d _C_o_m_p_l_e_t_i_o_n
  406.  
  407.      One area in which Bash shines is command line  editing.
  408. Bash  uses  the _r_e_a_d_l_i_n_e library to read and edit lines when
  409. interactive.  Readline is  a  powerful  and  flexible  input
  410. facility that a user can configure to individual tastes.  It
  411. allows lines to be edited using either emacs or vi commands,
  412. where  those  commands are appropriate.  The full capability
  413. of emacs is not present - there is no way to execute a named
  414. command  with  M-x, for instance - but the existing commands
  415. are more than adequate.  The vi mode is compliant  with  the
  416. command line editing standardized by POSIX.2.
  417.  
  418.      Readline is fully customizable.   In  addition  to  the
  419. basic commands and key bindings, the library allows users to
  420. define additional key bindings using a  startup  file.   The
  421. _i_n_p_u_t_r_c file, which defaults to the file ~/._i_n_p_u_t_r_c, is read
  422. each time readline initializes, permitting users to maintain
  423. a  consistent  interface across a set of programs.  Readline
  424. includes an extensible interface, so each program using  the
  425. library  can  add  its  own  bindable  commands and program-
  426. specific key bindings.  Bash uses this facility to add bind-
  427. ings that perform history expansion or shell word expansions
  428. on the current input line.
  429.  
  430.      Readline interprets a number of variables which further
  431. tune  its  behavior.   Variables exist to control whether or
  432. not eight-bit characters are directly read as input or  con-
  433. verted  to  meta-prefixed key sequences (a meta-prefixed key
  434. sequence consists of  the  character  with  the  eighth  bit
  435. zeroed,  preceded  by  the  _m_e_t_a-_p_r_e_f_i_x  character,  usually
  436. escape,  which  selects  an  alternate  keymap),  to  decide
  437. whether  to  output  characters  with  the  eighth  bit  set
  438. directly or as a meta-prefixed key sequence, whether or  not
  439. to  wrap  to  a  new screen line when a line being edited is
  440. longer than the screen width, the keymap to which subsequent
  441. key  bindings  should apply, or even what happens when read-
  442. line wants to ring the terminal's bell.  All of these  vari-
  443. ables can be set in the inputrc file.
  444.  
  445.      The startup file understands a set of  C  preprocessor-
  446. like  conditional  constructs  which  allow variables or key
  447. bindings to be assigned based on the application using read-
  448. line,  the  terminal  currently  being  used, or the editing
  449. mode.  Users can add program-specific bindings to make their
  450. lives easier:  I have bindings that let me edit the value of
  451. $_P_A_T_H and double-quote the current or previous word:
  452.      # Macros that are convenient for shell interaction
  453.  
  454.  
  455.                        July 18, 1994
  456.  
  457.  
  458.  
  459.  
  460.  
  461.                            - 8 -
  462.  
  463.  
  464.      $if Bash
  465.      # edit the path
  466.      "\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f"
  467.      # prepare to type a quoted word -- insert open and close double
  468.      # quotes and move to just after the open quote
  469.      "\C-x\"": "\"\"\C-b"
  470.      # Quote the current or previous word
  471.      "\C-xq": "\eb\"\ef\""
  472.      $endif
  473. There is a readline command to re-read the  file,  so  users
  474. can  edit  the  file, change some bindings, and begin to use
  475. them almost immediately.
  476.  
  477.      Bash implements the _b_i_n_d builtin for more  dyamic  con-
  478. trol  of  readline  than  the startup file permits.  _B_i_n_d is
  479. used in several ways.  In _l_i_s_t  mode,  it  can  display  the
  480. current  key  bindings, list all the readline editing direc-
  481. tives available for binding, list which keys invoke a  given
  482. directive,  or  output  the current set of key bindings in a
  483. format that can be incorporated  directly  into  an  inputrc
  484. file.   In  _b_a_t_c_h  mode,  it  reads a series of key bindings
  485. directly from a file and passes them to  readline.   In  its
  486. most  common usage, _b_i_n_d takes a single string and passes it
  487. directly to readline, which interprets the line as if it had
  488. just been read from the inputrc file.  Both key bindings and
  489. variable assignments may appear in the string given to _b_i_n_d.
  490.  
  491.      The readline library also  provides  an  interface  for
  492. _w_o_r_d  _c_o_m_p_l_e_t_i_o_n.   When  the  _c_o_m_p_l_e_t_i_o_n character (usually
  493. TAB) is typed, readline looks at the  word  currently  being
  494. entered  and  computes  the  set  of  filenames of which the
  495. current word is a valid prefix.  If there is only one possi-
  496. ble  completion,  the  rest  of  the characters are inserted
  497. directly,  otherwise  the  common  prefix  of  the  set   of
  498. filenames  is added to the current word.  A second TAB char-
  499. acter entered  immediately  after  a  non-unique  completion
  500. causes  readline  to list the possible completions; there is
  501. an option to have the list displayed immediately.   Readline
  502. provides  hooks  so  that  applications can provide specific
  503. types of completion before the default  filename  completion
  504. is attempted.  This is quite flexible, though it is not com-
  505. pletely user-programmable.  Bash, for example, can  complete
  506. filenames, command names (including aliases, builtins, shell
  507. reserved words, shell functions, and  executables  found  in
  508. the file system), shell variables, usernames, and hostnames.
  509. It uses a set of heuristics that, while not perfect, is gen-
  510. erally  quite good at determining what type of completion to
  511. attempt.
  512.  
  513. _4._4.  _H_i_s_t_o_r_y
  514.  
  515.      Access to the list of commands previously entered  (the
  516. _c_o_m_m_a_n_d  _h_i_s_t_o_r_y)  is  provided  jointly  by  Bash  and  the
  517.  
  518.  
  519.                        July 18, 1994
  520.  
  521.  
  522.  
  523.  
  524.  
  525.                            - 9 -
  526.  
  527.  
  528. readline  library.   Bash  provides  variables   ($HISTFILE,
  529. $HISTSIZE, and $HISTCONTROL) and the _h_i_s_t_o_r_y and _f_c builtins
  530. to manipulate the history  list.   The  value  of  $_H_I_S_T_F_I_L_E
  531. specifes  the  file where Bash writes the command history on
  532. exit and reads it on startup.  $_H_I_S_T_S_I_Z_E is  used  to  limit
  533. the  number  of commands saved in the history.  $_H_I_S_T_C_O_N_T_R_O_L
  534. provides a crude form of control  over  which  commands  are
  535. saved  on  the history list: a value of _i_g_n_o_r_e_s_p_a_c_e means to
  536. not save commands which begin  with  a  space;  a  value  of
  537. _i_g_n_o_r_e_d_u_p_s  means to not save commands identical to the last
  538. command saved.  $HISTCONTROL was named  $history_control  in
  539. earlier versions of Bash; the old name is still accepted for
  540. backwards compatibility.  The _h_i_s_t_o_r_y command  can  read  or
  541. write  files  containing  the  history  list and display the
  542. current list contents.  The _f_c builtin, adopted from POSIX.2
  543. and  the  Korn  Shell, allows display and re-execution, with
  544. optional editing, of commands from the  history  list.   The
  545. readline library offers a set of commands to search the his-
  546. tory list for a portion of  the  current  input  line  or  a
  547. string  typed  by  the  user.  Finally, the _h_i_s_t_o_r_y library,
  548. generally incorporated directly into the  readline  library,
  549. implements  a  facility  for  history recall, expansion, and
  550. re-execution of previous commands very similar to csh ("bang
  551. history", so called because the exclamation point introduces
  552. a history substitution):
  553.      $ echo a b c d e
  554.      a b c d e
  555.      $ !! f g h i
  556.      echo a b c d e f g h i
  557.      a b c d e f g h i
  558.      $ !-2
  559.      echo a b c d e
  560.      a b c d e
  561.      $ echo !-2:1-4
  562.      echo a b c d
  563.      a b c d
  564. The command history is only saved when the shell is interac-
  565. tive, so it is not available for use by shell scripts.
  566.  
  567. _4._5.  _N_e_w _S_h_e_l_l _V_a_r_i_a_b_l_e_s
  568.  
  569.      There are a number of convenience variables  that  Bash
  570. interprets  to  make  life  easier.   These include _F_I_G_N_O_R_E,
  571. which is a set of filename  suffixes  identifying  files  to
  572. exclude   when  completing  filenames;  _H_O_S_T_T_Y_P_E,  which  is
  573. automatically  set  to  a  string  describing  the  type  of
  574. hardware    on    which   Bash   is   currently   executing;
  575. _c_o_m_m_a_n_d__o_r_i_e_n_t_e_d__h_i_s_t_o_r_y, which directs  Bash  to  save  all
  576. lines of a multiple-line command such as a _w_h_i_l_e or _f_o_r loop
  577. in a single history entry,  allowing  easy  re-editing;  and
  578. _I_G_N_O_R_E_E_O_F,  whose  value indicates the number of consecutive
  579. EOF characters that an interactive shell  will  read  before
  580.  
  581.  
  582.  
  583.                        July 18, 1994
  584.  
  585.  
  586.  
  587.  
  588.  
  589.                            - 10 -
  590.  
  591.  
  592. exiting - an easy way to keep yourself from being logged out
  593. accidentally.  The _a_u_t_o__r_e_s_u_m_e variable alters the  way  the
  594. shell treats simple command names: if job control is active,
  595. and  this  variable  is  set,  single-word  simple  commands
  596. without  redirections  cause the shell to first look for and
  597. restart a suspended job with that name before starting a new
  598. process.
  599.  
  600. _4._6.  _B_r_a_c_e _E_x_p_a_n_s_i_o_n
  601.  
  602.      Since sh offers no convenient way to generate arbitrary
  603. strings  that  share  a  common  prefix  or suffix (filename
  604. expansion requires that the filenames  exist),  Bash  imple-
  605. ments  _b_r_a_c_e  _e_x_p_a_n_s_i_o_n,  a  capability  picked up from csh.
  606. Brace expansion is similar to filename  expansion,  but  the
  607. strings  generated need not correspond to existing files.  A
  608. brace expression consists of an optional _p_r_e_a_m_b_l_e,  followed
  609. by  a  pair  of braces enclosing a series of comma-separated
  610. strings,  and  an  optional  _p_o_s_t_a_m_b_l_e.   The  preamble   is
  611. prepended  to each string within the braces, and the postam-
  612. ble is then appended to each resulting string:
  613.      $ echo a{d,c,b}e
  614.      ade ace abe
  615. As this example demonstrates, the results of brace expansion
  616. are not sorted, as they are by filename expansion.
  617.  
  618. _4._7.  _P_r_o_c_e_s_s _S_u_b_s_t_i_t_u_t_i_o_n
  619.  
  620.      On systems that can support it, Bash provides a  facil-
  621. ity  known as _p_r_o_c_e_s_s _s_u_b_s_t_i_t_u_t_i_o_n.  Process substitution is
  622. similar to command substitution in  that  its  specification
  623. includes  a  command to execute, but the shell does not col-
  624. lect the command's output and insert  it  into  the  command
  625. line.   Rather,  Bash  opens a pipe to the command, which is
  626. run in the background.  The shell uses named  pipes  (FIFOs)
  627. or  the  /_d_e_v/_f_d  method  of naming open files to expand the
  628. process substitution to a filename  which  connects  to  the
  629. pipe  when  opened.  This filename becomes the result of the
  630. expansion.  Process substitution can be used to compare  the
  631. outputs  of two different versions of an application as part
  632. of a regression test:
  633.      $ cmp <(old_prog) <(new_prog)
  634. _4._8.  _P_r_o_m_p_t _C_u_s_t_o_m_i_z_a_t_i_o_n
  635.  
  636.      One of the more popular interactive features that  Bash
  637. provides  is the ability to customize the prompt.  Both $_P_S_1
  638. and $_P_S_2, the primary and secondary  prompts,  are  expanded
  639. before being displayed.  Parameter and variable expansion is
  640. performed when the prompt string is expanded, so  any  shell
  641. variable  can  be  put  into the prompt (e.g., $_S_H_L_V_L, which
  642.  
  643.  
  644.  
  645.                        July 18, 1994
  646.  
  647.  
  648.  
  649.  
  650.  
  651.                            - 11 -
  652.  
  653.  
  654. indicates how deeply the current  shell  is  nested).   Bash
  655. specially  interprets  characters  in the prompt string pre-
  656. ceded by a backslash.  Some of these backslash  escapes  are
  657. replaced  with the current time, the date, the current work-
  658. ing directory, the username, and the command number or  his-
  659. tory  number  of the command being entered.  There is even a
  660. backslash escape to cause the shell  to  change  its  prompt
  661. when running as root after an _s_u.  Before printing each pri-
  662. mary prompt, Bash expands the variable $_P_R_O_M_P_T__C_O_M_M_A_N_D  and,
  663. if it has a value, executes the expanded value as a command,
  664. allowing additional prompt customization.  For example, this
  665. assignment  causes  the  current user, the current host, the
  666. time, the last component of the current  working  directory,
  667. the  level  of  shell nesting, and the history number of the
  668. current command to be embedded into the primary prompt:
  669.      $ PS1='\u@\h [\t] \W($SHLVL:\!)\$ '
  670.      chet@odin [21:03:44] documentation(2:636)$ cd ..
  671.      chet@odin [21:03:54] src(2:637)$
  672. The string being assigned is surrounded by single quotes  so
  673. that  if it is exported, the value of $_S_H_L_V_L will be updated
  674. by a child shell:
  675.      chet@odin [21:17:35] src(2:638)$ export PS1
  676.      chet@odin [21:17:40] src(2:639)$ bash
  677.      chet@odin [21:17:46] src(3:696)$
  678. The \$ escape is displayed as "$" when running as  a  normal
  679. user, but as "#" when running as root.
  680.  
  681. _4._9.  _F_i_l_e _S_y_s_t_e_m _V_i_e_w_s
  682.  
  683.      Since Berkeley introduced symbolic links  in  4.2  BSD,
  684. one of their most annoying properties has been the "warping"
  685. to a completely different area of the file system when using
  686. _c_d,  and  the  resultant  non-intuitive behavior of "cd ..".
  687. The UNIX kernel treats symbolic links _p_h_y_s_i_c_a_l_l_y.  When  the
  688. kernel is translating a pathname in which one component is a
  689. symbolic link, it replaces all or part of the pathname while
  690. processing  the  link.  If the contents of the symbolic link
  691. begin  with  a  slash,  the  kernel  replaces  the  pathname
  692. entirely; if not, the link contents replace the current com-
  693. ponent.  In either case, the symbolic link is  visible.   If
  694. the  link value is an absolute pathname, the user finds him-
  695. self in a completely different part of the file system.
  696.  
  697.      Bash provides a _l_o_g_i_c_a_l view of the  file  system.   In
  698. this default mode, command and filename completion and buil-
  699. tin commands such as _c_d and _p_u_s_h_d which change  the  current
  700. working  directory transparently follow symbolic links as if
  701. they were directories.  The $_P_W_D variable, which  holds  the
  702. shell's  idea  of  the current working directory, depends on
  703. the path  used  to  reach  the  directory  rather  than  its
  704.  
  705.  
  706.  
  707.                        July 18, 1994
  708.  
  709.  
  710.  
  711.  
  712.  
  713.                            - 12 -
  714.  
  715.  
  716. physical  location  in the local file system hierarchy.  For
  717. example:
  718.      $ cd /usr/local/bin
  719.      $ echo $PWD
  720.      /usr/local/bin
  721.      $ pwd
  722.      /usr/local/bin
  723.      $ /bin/pwd
  724.      /net/share/sun4/local/bin
  725.      $ cd ..
  726.      $ pwd
  727.      /usr/local
  728.      $ /bin/pwd
  729.      /net/share/sun4/local
  730.      $ cd ..
  731.      $ pwd
  732.      /usr
  733.      $ /bin/pwd
  734.      /usr
  735. One problem with this, of course, arises when programs  that
  736. do  not  understand  the  shell's logical notion of the file
  737. system interpret ".." differently.  This  generally  happens
  738. when Bash completes filenames containing ".." according to a
  739. logical hierarchy which does not correspond to their  physi-
  740. cal  location.  For  users  who  find  this  troublesome,  a
  741. corresponding _p_h_y_s_i_c_a_l view of the file system is available:
  742.      $ cd /usr/local/bin
  743.      $ pwd
  744.      /usr/local/bin
  745.      $ set -o physical
  746.      $ pwd
  747.      /net/share/sun4/local/bin
  748. _4._1_0.  _I_n_t_e_r_n_a_t_i_o_n_a_l_i_z_a_t_i_o_n
  749.  
  750.      One of the most  significant  improvements  in  version
  751. 1.13  of  Bash  was  the  change to "eight-bit cleanliness".
  752. Previous versions used the eighth bit of characters to  mark
  753. whether  or not they were quoted when performing word expan-
  754. sions.  While this did not affect  the  majority  of  users,
  755. most  of  whom  used  only  seven-bit ASCII characters, some
  756. found it  confining.   Beginning  with  version  1.13,  Bash
  757. implemented a different quoting mechanism that did not alter
  758. the eighth bit of characters.  This allowed Bash to  manipu-
  759. late  files  with  "odd"  characters in their names, but did
  760. nothing to help users enter those  names,  so  version  1.13
  761. introduced  changes to readline that made it eight-bit clean
  762. as well.  Options exist that force  readline  to  attach  no
  763. special  significance  to characters with the eighth bit set
  764. (the default behavior is  to  convert  these  characters  to
  765. meta-prefixed  key sequences) and to output these characters
  766.  
  767.  
  768.  
  769.                        July 18, 1994
  770.  
  771.  
  772.  
  773.  
  774.  
  775.                            - 13 -
  776.  
  777.  
  778. without  conversion  to  meta-prefixed   sequences.    These
  779. changes, along with the expansion of keymaps to a full eight
  780. bits, enable readline to work with most of the ISO-8859 fam-
  781. ily of character sets, used by many European countries.
  782.  
  783. _4._1_1.  _P_O_S_I_X _M_o_d_e
  784.  
  785.      Although Bash is intended  to  be  POSIX.2  conformant,
  786. there  are areas in which the default behavior is not compa-
  787. tible with the standard.  For users who wish to operate in a
  788. strict  POSIX.2  environment,  Bash implements a _P_O_S_I_X _m_o_d_e.
  789. When this mode is active, Bash modifies its  default  opera-
  790. tion  where  it  differs from POSIX.2 to match the standard.
  791. POSIX mode is entered when Bash is started with  the  -_p_o_s_i_x
  792. option.   This feature is also available as an option to the
  793. set builtin, set -o posix.  For compatibility with other GNU
  794. software  that  attempts  to be POSIX.2 compliant, Bash also
  795. enters POSIX mode if the variable  $_P_O_S_I_X_L_Y__C_O_R_R_E_C_T  is  set
  796. when  Bash  is started or assigned a value during execution.
  797. $_P_O_S_I_X__P_E_D_A_N_T_I_C is accepted as well, to be  compatible  with
  798. some  older  GNU  utilities.   When Bash is started in POSIX
  799. mode, for example, it sources the file named by the value of
  800. $_E_N_V  rather  than  the "normal" startup files, and does not
  801. allow reserved words to be aliased.
  802.  
  803. _5.  _N_e_w _F_e_a_t_u_r_e_s _a_n_d _F_u_t_u_r_e _P_l_a_n_s
  804.  
  805.      There are several features introduced  in  the  current
  806. version of Bash, version 1.14, and a number under considera-
  807. tion for future releases.  This section will briefly  detail
  808. the  new  features  in  version  1.14  and  describe several
  809. features that may appear in later versions.
  810.  
  811. _5._1.  _N_e_w _F_e_a_t_u_r_e_s _i_n _B_a_s_h-_1._1_4
  812.  
  813.      The new features available in Bash-1.14 answer  several
  814. of the most common requests for enhancements.  Most notably,
  815. there is a mechanism  for  including  non-visible  character
  816. sequences  in  prompts, such as those which cause a terminal
  817. to print characters in different colors or in standout mode.
  818. There  was  nothing preventing the use of these sequences in
  819. earlier  versions,  but  the  readline  redisplay  algorithm
  820. assumed  each  character  occupied physical screen space and
  821. would wrap lines prematurely.
  822.  
  823.      Readline has a few new variables, several new  bindable
  824. commands,  and  some additional emacs mode default key bind-
  825. ings.  A new history search mode has  been  implemented:  in
  826. this mode, readline searches the history for lines beginning
  827. with the characters between the  beginning  of  the  current
  828. line  and  the  cursor.   The  existing readline incremental
  829. search commands no longer match identical  lines  more  than
  830. once.   Filename  completion now expands variables in direc-
  831. tory names.  The history expansion facilities are now nearly
  832.  
  833.  
  834.  
  835.                        July 18, 1994
  836.  
  837.  
  838.  
  839.  
  840.  
  841.                            - 14 -
  842.  
  843.  
  844. completely csh-compatible: missing modifiers have been added
  845. and history substitution has been extended.
  846.  
  847.      Several of the features described earlier, such as  _s_e_t
  848. -_o  _p_o_s_i_x  and  $_P_O_S_I_X__P_E_D_A_N_T_I_C,  are  new  in version 1.14.
  849. There is a new shell variable, _O_S_T_Y_P_E, to which Bash assigns
  850. a  value that identifies the version of UNIX it's running on
  851. (great for putting architecture-specific binary  directories
  852. into the $PATH).  Two variables have been renamed: $_H_I_S_T_C_O_N_-
  853. _T_R_O_L  replaces  $_h_i_s_t_o_r_y__c_o_n_t_r_o_l,  and  $_H_O_S_T_F_I_L_E   replaces
  854. $_h_o_s_t_n_a_m_e__c_o_m_p_l_e_t_i_o_n__f_i_l_e.  In both cases, the old names are
  855. accepted for backwards compatibility.  The ksh  _s_e_l_e_c_t  con-
  856. struct,  which  allows  the  generation of simple menus, has
  857. been implemented.   New  capabilities  have  been  added  to
  858. existing  variables:  $_a_u_t_o__r_e_s_u_m_e  can  now  take values of
  859. _e_x_a_c_t or _s_u_b_s_t_r_i_n_g, and $_H_I_S_T_C_O_N_T_R_O_L understands  the  value
  860. _i_g_n_o_r_e_b_o_t_h,  which  combines  the  two previously acceptable
  861. values.  The _d_i_r_s builtin has acquired options to print  out
  862. specific members of the directory stack.  The $_n_o_l_i_n_k_s vari-
  863. able, which forces a physical view of the file  system,  has
  864. been  superseded  by  the  -_P  option  to  the  _s_e_t  builtin
  865. (equivalent to set -o physical); the  variable  is  retained
  866. for  backwards  compatibility.  The version string contained
  867. in $_B_A_S_H__V_E_R_S_I_O_N now includes an  indication  of  the  patch
  868. level  as  well  as  the  "build version".  Some little-used
  869. features have been removed:  the _b_y_e synonym  for  _e_x_i_t  and
  870. the  $_N_O__P_R_O_M_P_T__V_A_R_S  variable  are  gone.   There is now an
  871. organized test suite that can be run as  a  regression  test
  872. when building a new version of Bash.
  873.  
  874.      The documentation has been thoroughly overhauled: there
  875. is  a  new  manual page on the readline library and the _i_n_f_o
  876. file has been updated to reflect the  current  version.   As
  877. always,  as  many bugs as possible have been fixed, although
  878. some surely remain.
  879.  
  880. _5._2.  _O_t_h_e_r _F_e_a_t_u_r_e_s
  881.  
  882.      There are a few features that  I  hope  to  include  in
  883. later Bash releases.  Some are based on work already done in
  884. other shells.
  885.  
  886.      In addition to simple variables, a  future  release  of
  887. Bash  will  include  one-dimensional  arrays,  using the ksh
  888. implementation of arrays as a model.  Additions to  the  ksh
  889. syntax,  such  as  _v_a_r_n_a_m_e=( ... ) to assign a list of words
  890. directly to an array and a mechanism to allow the _r_e_a_d buil-
  891. tin  to  read a list of values directly into an array, would
  892. be desirable.  Given those extensions, the ksh _s_e_t -_A syntax
  893. may not be worth supporting (the -_A option assigns a list of
  894. values to an array, but is a rather peculiar special case).
  895.  
  896.      Some shells include a means of _p_r_o_g_r_a_m_m_a_b_l_e  word  com-
  897. pletion, where the user specifies on a per-command basis how
  898.  
  899.  
  900.  
  901.                        July 18, 1994
  902.  
  903.  
  904.  
  905.  
  906.  
  907.                            - 15 -
  908.  
  909.  
  910. the arguments of the command are to be treated when  comple-
  911. tion  is  attempted:  as  filenames,  hostnames,  executable
  912. files, and so on.  The other aspects  of  the  current  Bash
  913. implementation  could  remain as-is; the existing heuristics
  914. would still be valid.  Only when completing the arguments to
  915. a  simple  command  would  the programmable completion be in
  916. effect.
  917.  
  918.      It would also be nice to give  the  user  finer-grained
  919. control over which commands are saved onto the history list.
  920. One proposal is for a variable,  tentatively  named  _H_I_S_T_I_G_-
  921. _N_O_R_E,  which  would  contain  a colon-separated list of com-
  922. mands.  Lines beginning with these commands, after the  res-
  923. trictions  of  $_H_I_S_T_C_O_N_T_R_O_L  have been applied, would not be
  924. placed onto the history list.   The  shell  pattern-matching
  925. capabilities  could  also  be  available when specifying the
  926. contents of $_H_I_S_T_I_G_N_O_R_E.
  927.  
  928.      One thing that newer shells such as _w_k_s_h (also known as
  929. _d_t_k_s_h)  provide is a command to dynamically load code imple-
  930. menting additional builtin commands into  a  running  shell.
  931. This new builtin would take an object file or shared library
  932. implementing the "body" of the  builtin  (_x_x_x__b_u_i_l_t_i_n()  for
  933. those familiar with Bash internals) and a structure contain-
  934. ing the name of the new command, the function to  call  when
  935. the new builtin is invoked (presumably defined in the shared
  936. object specified as an argument), and the  documentation  to
  937. be  printed  by  the  _h_e_l_p  command (possibly present in the
  938. shared object as well).  It  would  manage  the  details  of
  939. extending the internal table of builtins.
  940.  
  941.      A few other builtins would also be desirable:  two  are
  942. the POSIX.2 _g_e_t_c_o_n_f command, which prints the values of sys-
  943. tem configuration variables defined by POSIX.2, and a _d_i_s_o_w_n
  944. builtin,  which  causes  a  shell  running  with job control
  945. active to "forget about" one or more background jobs in  its
  946. internal  jobs  table.   Using  _g_e_t_c_o_n_f, for example, a user
  947. could retrieve a value for $_P_A_T_H guaranteed to find  all  of
  948. the POSIX standard utilities, or find out how long filenames
  949. may be in the file system containing a specified directory.
  950.  
  951.      There are no implementation timetables for any of these
  952. features,  nor are there concrete plans to include them.  If
  953. anyone has comments on these proposals, feel free to send me
  954. electronic mail.
  955.  
  956. _6.  _R_e_f_l_e_c_t_i_o_n_s _a_n_d _L_e_s_s_o_n_s _L_e_a_r_n_e_d
  957.  
  958.      The lesson that has been  repeated  most  often  during
  959. Bash  development  is  that  there  are  dark corners in the
  960. Bourne Shell, and people use all of them.  In  the  original
  961. description of the Bourne shell, quoting and the shell gram-
  962. mar are both poorly  specified  and  incomplete;  subsequent
  963. descriptions have not helped much.  The grammar presented in
  964.  
  965.  
  966.  
  967.                        July 18, 1994
  968.  
  969.  
  970.  
  971.  
  972.  
  973.                            - 16 -
  974.  
  975.  
  976. Bourne's paper describing the  shell  distributed  with  the
  977. Seventh  Edition  of  UNIX|-  is  so far off that it does not
  978. allow the command who|wc.  In fact, as Tom Duff states:
  979.  
  980.      Nobody really knows what the Bourne shell's  gram-
  981.      mar  is.   Even  examination of the source code is
  982.      little help.|=
  983.  
  984. The POSIX.2 standard includes  a  _y_a_c_c  grammar  that  comes
  985. close  to  capturing  the  Bourne  shell's  behavior, but it
  986. disallows some constructs which sh accepts without complaint
  987. -  and there are scripts out there that use them.  It took a
  988. few versions and several bug reports before Bash implemented
  989. sh-compatible  quoting,  and there are still some "legal" sh
  990. constructs which Bash flags as syntax errors.   Complete  sh
  991. compatibility is a tough nut.
  992.  
  993.      The shell is bigger  and  slower  than  I  would  like,
  994. though the current version is substantially faster than pre-
  995. viously.  The readline library  could  stand  a  substantial
  996. rewrite.   A  hand-written  parser  to  replace  the current
  997. _y_a_c_c-generated one would probably result in a  speedup,  and
  998. would solve one glaring problem:  the shell could parse com-
  999. mands in "$(...)" constructs as  they  are  entered,  rather
  1000. than reporting errors when the construct is expanded.
  1001.  
  1002.      As always, there is some chaff to go  with  the  wheat.
  1003. Areas  of  duplicated  functionality  need to be cleaned up.
  1004. There are several cases where Bash treats  a  variable  spe-
  1005. cially   to   enable  functionality  available  another  way
  1006. ($notify vs.  set -o notify and $nolinks vs. set  -o  physi-
  1007. cal,  for  instance);  the special treatment of the variable
  1008. name should probably be removed.  A few  more  things  could
  1009. stand    removal;    the    $_a_l_l_o_w__n_u_l_l__g_l_o_b__e_x_p_a_n_s_i_o_n   and
  1010. $_g_l_o_b__d_o_t__f_i_l_e_n_a_m_e_s variables are of particularly  question-
  1011. able  value.   The  $[...]  arithmetic  evaluation syntax is
  1012. redundant now that the POSIX-mandated $((...)) construct has
  1013. been implemented, and could be deleted.  It would be nice if
  1014. the text output by the _h_e_l_p builtin  were  external  to  the
  1015. shell rather than compiled into it.  The behavior enabled by
  1016. $_c_o_m_m_a_n_d__o_r_i_e_n_t_e_d__h_i_s_t_o_r_y, which causes the shell to attempt
  1017. to  save  all lines of a multi-line command in a single his-
  1018. tory entry, should be made  the  default  and  the  variable
  1019. removed.
  1020.  
  1021.  
  1022. _________________________
  1023. |-S. R. Bourne, "UNIX  Time-Sharing  System:   The  UNIX
  1024. Shell",  _B_e_l_l  _S_y_s_t_e_m  _T_e_c_h_n_i_c_a_l  _J_o_u_r_n_a_l, 57(6), July-
  1025. August, 1978, pp. 1971-1990.
  1026. |=Tom Duff, "Rc - A Shell for Plan 9 and UNIX  systems",
  1027. _P_r_o_c. _o_f _t_h_e _S_u_m_m_e_r _1_9_9_0 _E_U_U_G _C_o_n_f_e_r_e_n_c_e, London, July,
  1028. 1990, pp. 21-33.
  1029.  
  1030.  
  1031.  
  1032.  
  1033.                        July 18, 1994
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.                            - 17 -
  1040.  
  1041.  
  1042. _7.  _A_v_a_i_l_a_b_i_l_i_t_y
  1043.  
  1044.      As with all other GNU software, Bash is  available  for
  1045. anonymous  FTP  from _p_r_e_p._a_i._m_i_t._e_d_u:/_p_u_b/_g_n_u and from other
  1046. GNU software mirror sites.  The current version is in  _b_a_s_h-
  1047. _1._1_4._1._t_a_r._g_z  in  that  directory.   Use _a_r_c_h_i_e to find the
  1048. nearest archive site.  The latest version is  always  avail-
  1049. able  for FTP from _b_a_s_h._C_W_R_U._E_d_u:/_p_u_b/_d_i_s_t.  Bash documenta-
  1050. tion is available for FTP from _b_a_s_h._C_W_R_U._E_d_u:/_p_u_b/_b_a_s_h.
  1051.  
  1052.      The Free Software Foundation sells  tapes  and  CD-ROMs
  1053. containing Bash; send electronic mail to gnu@prep.ai.mit.edu
  1054. or call +1-617-876-3296 for more information.
  1055.  
  1056.      Bash is  also  distributed  with  several  versions  of
  1057. UNIX-compatible  systems.   It  is  included  as /bin/sh and
  1058. /bin/bash on several Linux  distributions  (more  about  the
  1059. difference  in  a  moment),  and  as contributed software in
  1060. BSDI's BSD/386* and FreeBSD.
  1061.  
  1062.      The Linux distribution deserves special mention.  There
  1063. are two configurations included in the standard Bash distri-
  1064. bution: a "normal" configuration, in which all of the  stan-
  1065. dard  features  are included, and a "minimal" configuration,
  1066. which omits job control, aliases, history and  command  line
  1067. editing,  the  directory  stack and _p_u_s_h_d/_p_o_p_d/_d_i_r_s, process
  1068. substitution, prompt string special character decoding,  and
  1069. the  _s_e_l_e_c_t  construct.  This minimal version is designed to
  1070. be a drop-in replacement for the traditional  UNIX  /bin/sh,
  1071. and is included as the Linux /bin/sh in several packagings.
  1072.  
  1073. _8.  _C_o_n_c_l_u_s_i_o_n
  1074.  
  1075.      Bash is a worthy successor to sh.  It  is  sufficiently
  1076. portable to run on nearly every version of UNIX from 4.3 BSD
  1077. to SVR4.2, and several UNIX workalikes.  It is robust enough
  1078. to  replace  sh  on most of those systems, and provides more
  1079. functionality.  It has several thousand regular  users,  and
  1080. their  feedback has helped to make it as good as it is today
  1081. - a testament to the benefits of free software.
  1082.  
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092. _________________________
  1093. *BSD/386 is a trademark of  Berkeley  Software  Design,
  1094. Inc.
  1095.  
  1096.  
  1097.  
  1098.  
  1099.                        July 18, 1994
  1100.  
  1101.  
  1102.